package com.fan.configService.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fan.configService.exception.QhException;
import com.fan.configService.exception.QhUserErrors;
import com.fan.configService.mapper.UserMapper;
import com.fan.configService.po.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * java类简单作用描述
 *
 * @Description: java类作用描述
 * @Author: hf
 * @CreateDate: 2019/6/18 11:29
 * @UpdateUser: hf
 * @UpdateDate: 2019/6/18 11:29
 * @UpdateRemark: The modified content
 * @Version: 1.0
 */

@Slf4j
@Service
public class UserService {
    @Autowired
    UserMapper userMapper;

    public User findUserByLoginName(String loginName) {
        LambdaQueryWrapper<User> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(User::getLoginName,loginName);
        return userMapper.selectOne(lambdaQueryWrapper);

//        throw new QhException(QhUserErrors.USER_NOT_EXIST);
    }

    public User findUserByUserId(Long userId) {
        return userMapper.selectUserById();
    }

}
